<extend name="Base/common"/>
<block name="body">
<!--<div class="container">
<div class="nav">
    <img src="__IMG__/img_1.png" alt="" id="show">
    <h3>绑定银行卡</h3>
</div>
<div class="bank-bindbox">
<div class="bank-bindtop">
	<img src="__IMG__/icon07.png" class="bank-binding" /> &nbsp;提现卡绑定
</div>
<div class="bank-bindconter">
	<input type="text" class="bank-bindinput" name="bank_realname" id="bank_realname" placeholder="银行卡持卡人"/>
	<input type="text" class="bank-bindinput" name="bank_card" id="bank_card" placeholder="银行卡卡号"/>
	<input type="text" class="bank-bindinput" name="id_card" id="id_card" placeholder="持卡人身份证号"/>

	<div class="bank-bindselect">
		<img src="__IMG__/icon08.png"  class="bank-binddown"/>
		<div class="bank-xians">中国银行</div>
		<div class="bank-moni clearfix">
		</div>
	</div>
	<input type="text" class="bank-bindinput" id="outlets_name" name="outlets_name" placeholder="开户行地址"/>
	<input type="text" class="bank-bindinput" name="pro_name" id="pro_name" placeholder="开户省份"/>
	<input type="text" class="bank-bindinput" name="city_name" id="city_name" placeholder="开户市"/>
	<p class="bank-bindtips">为了您的资金安全，此帐号为您唯一的提现账号，请务必仔细核对以上信息</p>
	<p class="bank-bindtips clearfix">
		<a class="bank-bindok bank-bindti" href="javascript:subform()">确认</a>
		<a href="javascript:reset()" class="bank-bindno bank-bindti">取消</a>
	</p>
</div>
</div>-->

<div class="proDelBox" style="font-size: 12px;">
	<div class="proDelPayLi proDelBorderBottm">
		<p class="proDelBorderBottm">
			<span class="al">开户姓名</span>
			<input class="ax" id="proname" type="text" placeholder="请输入开户姓名"/>
		</p>
		<p>
			<span class="al">身份证号</span>
			<input class="ax" id="proid" type="text" placeholder="请输入身份证号"/>
		</p>
	</div>
	<div class="proDelPayLi proDelBorderBottm" style="margin-top: 20px;">
		<p>
			<span class="al">选择开户银行</span>
			<span class="ax" id="bankclick">农业银行</span>
		</p>
	</div>
	<div class="proDelPayLi proDelBorderBottm" style="margin-top: 20px;">
		<p class="proDelBorderBottm">
			<span class="al" style="flex:2.63">开户地址</span>
			<span class="al" id="cityN" style="text-align: left;">四川省</span>
			<span class="al" id="cityX" style="text-align: center;">成都</span>
		</p>
		<p>
			<span class="al">所在支行</span>
			<input class="ax" id="proidcity" type="text" placeholder="请输入所在支行地址"/>
		</p>
	</div>
	<div class="proDelPayLi proDelBorderBottm" style="margin-top: 20px;">
		<p>
			<span class="al">银行卡号</span>
			<input class="ax" type="text" id="proidcar" placeholder="请输入银行卡号"/>
		</p>
	</div>
<p style="padding:0px 20px;margin: 20px auto;" class="defaultAsh"><span class="icon-uniE90A defaultBlue"></span>为了您的资金安全,此账号为您唯一的提现账号,请务必仔细核对以上信息。</p>
<p style="padding:0px 20px;line-height: 36px;height: 36px;"><a href="javascript:subform()" class="proDelSubmit">确认信息</a></p>
<p style="padding:0px 20px;line-height: 36px;height: 36px;"><span id="clear" href="javascript:reset()" class="proDelDfel">重置信息</span></p>
</div>
<div id="banklist" class="bank-moni clearfix"></div>
<div id="citylist" class="bank-moni clearfix"></div>
<style>	
	.bank-moni{top:191px;height: 300px;overflow: scroll;}
</style>
<script src="__NEW__/option/js/bank.js" type="text/javascript" charset="utf-8"></script>
<script src="__NEW__/option/js/city.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
// 显示银行列表
$('#bankclick').click(function(){
	$('#banklist').toggle();
})
// 动态太假银行
var htmlcear=''
$.map(b_data, function(val,i) {
	htmlcear+='<div>'+val+'</div>'
});
$('#banklist').html(htmlcear);
$('#banklist').find('div').each(function(){
	$(this).click(function(){
		$(this).addClass('ass').siblings().removeClass('ass');
		$('#banklist').toggle();
		var val=$(this).html();
		$('#bankclick').html(val);
	})
})


// 重置
$('#clear').click(function(){
	$('#proname').val('');
	$('#proid').val('');
	$('#bankclick').html('');
	$('#proctiy').val('');
	$('#proidcity').val('');
	$('#proidcar').val('');
})
//省点击
$('#cityN').click(function(){
var ctiyhtml='';
$.map(s_data['p'],function(val,i){
	ctiyhtml+='<div>'+val+'</div>'
})
$('#citylist').html('').html(ctiyhtml).show();
clickcitywho=1;
})
// 市点击
$('#cityX').click(function(){
var ctiyhtml='',dlname=$('#cityN').html();
$.map(s_data['c'][dlname],function(val,i){
	ctiyhtml+='<div>'+val+'</div>'
})
$('#citylist').html('').html(ctiyhtml).show();
clickcitywho=2
})
// city点击返回
var clickcitywho;
$('#citylist').delegate('div','click',function(){
	var nameval=$(this).html();
	if (clickcitywho=='1') {
		$('#cityN').html('').html(nameval);
		$('#cityX').html('').html(s_data['c'][nameval][0])
	}else if (clickcitywho==2){
		$('#cityX').html('').html(nameval);
	};
	$('#citylist').hide();
});




function subform(e){
	//e.stopPropagation;
	var bank_name=$('#bankclick').html();
	var bank_realname=$('#proname').val();
	var bank_card=$('#proidcar').val();
	var id_card=$('#proid').val();
	var id_card_length=id_card.length;

	var outlets_name=$('#proidcity').val();
	var pro_name=$('#cityN').html();
	var city_name=$('#cityX').html();
	var url="{:U('User/bank_binding')}";
	  var reg = /^(\d{16}|\d{19})$/;
	if(bank_realname==''){
		alert('开户姓名不能为空');
		return false;
	}
        if (id_card.length != 15 && id_card.length != 18 && id_card.length != 19) {
		alert("输入身份证号码格式不正确!");
		return false;
	}
	if(bank_name==''){
		alert('银行名称不能为空');
		return false;
	}

	if(pro_name==''){
		alert('开户省不能为空');
		return false;
	}
	if(city_name==''){
		alert('开户市不能为空');
		return false;
	}
	if(outlets_name==''){
		alert('所在支行不能为空');
		return false;
	}

	if( !reg.test(bank_card) ) {
		alert("银行卡号，应该是16或19位数字！");
		return false;
	}
	$.post(url,
			{
				bank_name:bank_name,
				bank_realname:bank_realname,
				bank_card:bank_card,
				id_card:id_card,
				outlets_name:outlets_name,
				pro_name:pro_name,
				city_name:city_name,
			},function(data){
          		if(data.status){
          			alert(data.msg,2000);
          			//return false;
          			//$('.msg').html(data.msg);
          			setTimeout(link_url,1000);
          		}else{
          			alert(data.msg,2000);
          			return false;
          			//$('.msg').html(data.msg);
          		}
        },'json')
}

function link_url(){
		var url_href="{:U('User/bank_index')}";
		window.location.href=url_href;
}
function reset(){
	window.location.reload();
}
</script>
</div>
<include file="Public/footer"/>
</block>
